<template >
    <div @click="handleAdd">按钮组件{{ type }}</div>
    <div>{{ res }}</div>
    <div>{{ n }}</div>
</template>
<script setup>
import {ref,inject} from 'vue';
const props=defineProps({
    type:{
        type:String,
        default:"success"
    }
})
// console.log(props.type);
const emits=defineEmits(['add']);
const handleAdd=()=>{
    emits('add')
}
let res=inject('key');
let n=ref(5);
const add=()=>{
    n.value++;
}
defineExpose({
    n,add
})
</script>
<style></style>